﻿using System.Windows;
#if (WINRT)
using nRoute.Behaviors.Interactivity;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#else
using System.Windows.Controls;
using System.Windows.Interactivity;
#endif

namespace nRoute.Behaviors
{
    public class SetFocusAction
#if (SILVERLIGHT || WINRT)
        : TriggerAction<Control>
#else
        : TriggerAction<UIElement>
#endif
    {
        protected override void Invoke(object parameter)
        {
#if (WINRT)
             if (AssociatedObject != null) AssociatedObject.Focus(FocusState.Programmatic);
#else
            if (AssociatedObject != null) AssociatedObject.Focus();
#endif
        }
    }
}
